//
//  UILabel + Extension.swift
//  01- 搭建框架
//
//  Created by as888 on 15/10/16.
//  Copyright © 2015年 任伟. All rights reserved.
//

import UIKit

extension UILabel {

    //遍历构造函数
    convenience init(title: String,
        fontSize: CGFloat = 14,
        color: UIColor = UIColor.darkGrayColor(),
        screenInset: CGFloat = 0) {
    self.init()
        
        text = title
        textColor = color
        font = UIFont.systemFontOfSize(fontSize)
            
        numberOfLines = 0
        
            if screenInset == 0 {
                textAlignment = .Center
            }else {
                preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2 * screenInset
                textAlignment = .Left
            }
            
}
}
